let len = 6;
let nums = [2, 2, 1, 3, 4, 7, 7, 1];
var maxSubArray = function (nums) {
  const memo = [];
  memo[0] = 1;
  let max = 1;

  for (let i = 1; i < nums.length; i++) {
    memo[i] = nums[i] >= nums[i - 1] ? memo[i - 1] + 1 : 1;

    // 每生成一个memo[i]就与max比较
    max = Math.max(max, memo[i]);
  }
  console.log(memo);

  return max;
};

console.log(maxSubArray(nums));
